// 考勤迟到累计处理
/**
 * 每月最多免除迟到3次， 每次迟到10分钟内免除。
 */
function compute(computeParam,computeResult,ruleParams){

    var baseParam = JSON.parse(ruleParams);
    var maxTimesIgnore = baseParam.maxTimesIgnore || 3;
    var maxAvoidMinute = baseParam.maxAvoidMinute || 10;

    var params= computeParam.getAttendParams() ;
    var timesIgnore = 0
    var totalMinutes = 0

    for (var i=0;i<params.size();i++){
        if(params.get(i).getDelay() <= maxAvoidMinute){
            if(timesIgnore+1<=maxTimesIgnore){
                timesIgnore += 1
                params.get(i).setBeAvoid(true)
            }
        }else{
            totalMinutes += params.get(i).getDelay()
            params.get(i).setBeAvoid(false)
        }
    }
    computeResult.setRemark( "考勤分析迟到结果: ");

    computeResult.setAttendParams(params);
    computeResult.setTimesIgnore(timesIgnore)
    computeResult.setTotalMinutes(totalMinutes)
}
